package com.cindata;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class ProgressUtil
{

    public static final Map<Long, BigDecimal> progressMap = new HashMap<Long, BigDecimal>(100);

    private static final Lock lock = new ReentrantLock();

    //设置执行进度
    public static void setProgress(Long progressKey, BigDecimal progress)
    {
        lock.lock();
        progressMap.put(progressKey, progress);
        lock.unlock();
    }

    //设置执行进度
//    public static void addProgress(Long progressKey, BigDecimal progress) {
//        lock.lock();
//        if (progressMap.containsKey(progressKey)) {
////            progressMap.put(progressKey,valueOf(progressMap.get(progressKey).intValue() + progress.intValue()));
//        } else {
//            progressMap.put(progressKey, progress);
//        }
//        lock.unlock();
//    }
}
